class Solution {
    public int[] getLeastNumbers(int[] arr, int k) {
        int[] num = new int[k];
        Arrays.sort(arr);
        for (int i = 0; i < k; ++i) {
            num[i] = arr[i];
        }
        return num;
    }
}